package main

import (
	"fmt"
	"github.com/robfig/cron"
	"reflect"
	"sync"
	"time"
)

type testStructLock struct {
	name  string
	tType reflect.Value
	sync.Mutex
}

var testTed sync.Map

func main() {
	crontab := cron.New()
	crontab.AddFunc("*/2 * * * * *", DoTestTed)
	crontab.Start()
	cc := make([]byte, 100000000)
	for _ = range cc {
	}
	select {}
}

func (t *testStructLock) DoTestStructLock() {
	fmt.Println("*************start************")
	t.Lock()
	time.Sleep(time.Second * 3)
	fmt.Println("test")
	t.Unlock()
}

func DoTestTed() {
	fmt.Println(testTed.Load(1))
	testTed.Store(1, 2)
	defer testTed.Delete(1)
}
